﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace NFine.Data.Migrations
{
    public partial class Delete_TenantId_To_WxUser : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_wx_user_sys_tenant_TenantId",
                table: "wx_user");

            migrationBuilder.DropIndex(
                name: "IX_wx_user_TenantId",
                table: "wx_user");

            migrationBuilder.DropColumn(
                name: "TenantId",
                table: "wx_user");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<long>(
                name: "TenantId",
                table: "wx_user",
                nullable: false,
                defaultValue: 0L);

            migrationBuilder.CreateIndex(
                name: "IX_wx_user_TenantId",
                table: "wx_user",
                column: "TenantId");

            migrationBuilder.AddForeignKey(
                name: "FK_wx_user_sys_tenant_TenantId",
                table: "wx_user",
                column: "TenantId",
                principalTable: "sys_tenant",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
